package day09API.file;

import java.io.File;
import java.io.FileFilter;

public class Test02 {
    public static void main(String[] args) {
        File file = new File("./File");
        if (file.isDirectory()){
        File[] files;
        files = file.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                String name = pathname.getName();
                return name.matches(".*[s]+.*");
            }
        });
        for(File f:files){
            System.out.println(f);
        }

    }
        if (file.isDirectory()){
            File[] files = file.listFiles(pathname -> pathname.getName().matches(".*[s]+.*"));
            for(File f:files){
                System.out.println(f);
            }
        }
        if (file.isDirectory()){
            File[] files = file.listFiles((File pathname) ->{return pathname.getName().matches(".*[s]+.*");});
            for(File f:files){
                System.out.println(f);
            }
        }
    }
}
